#include "e2d/yml/render/Serializer.h"

using Serializer = e2d::BasicSerializer;

template<>
 void Serializer::Encode<e2d::CameraView>(YAML::Node& node, const e2d::CameraView& inst)
{
	Encode<e2d::Object>(node, inst);

	SetVariable<e2d::ProjData>(node, "m_ProjData", inst.m_ProjData);

	SetVariable<glm::vec4>(node, "bgColor", inst.m_BackgroundColor);
	SetVariable<bool>(node, "clearColor", inst.m_ClearColor);
	SetVariable<bool>(node, "clearDepthStencil", inst.m_ClearDepthStencil);
	
	SetVariable<int>(node, "editingIndex", inst.m_EditingIndex);

}


template<>
 bool Serializer::Decode<e2d::CameraView>(const YAML::Node& node, e2d::CameraView& inst)
{
	Decode<e2d::Object>(node, inst);
	GetVariable<e2d::ProjData>(node, "m_ProjData", inst.m_ProjData);

	GetVariable<int>(node, "m_NrComponent", inst.m_NrComponent);
	GetVariable<int>(node, "m_HDR", inst.m_HDR);


	GetVariable<glm::vec4>(node, "bgColor", inst.m_BackgroundColor);

	GetVariable<bool>(node, "clearColor", inst.m_ClearColor);
	GetVariable<bool>(node, "clearDepthStencil", inst.m_ClearDepthStencil);

	GetVariable<int>(node, "editingIndex", inst.m_EditingIndex);

	return true;
}
